# eric7.RemoteServerInterface.EricServerInterface

Module implementing the interface to the eric remote server.

### Global Attributes

None

### Classes

EricServerInterface | Class implementing the interface to the eric remote server.

### Functions

None

## EricServerInterface

Class implementing the interface to the eric remote server.

### Signals

aboutToDisconnect()
  emitted just befor the remote server is disconnected
connectionStateChanged(state:bool)
  emitted to indicate a change of the connection state
remoteCoverageReply(request:str, params:dict)
  emitted to deliver the reply of a remote server code coverage request
remoteDebuggerReply(request:str, params:dict)
  emitted to deliver the reply of a remote server debugger request
remoteEchoReply(request:str, params:dict)
  emitted to deliver the reply of a remote server echo request
remoteEditorConfig(request:str, params:dict)
  emitted to deliver the reply of a remote server editor config request
remoteFileSystemReply(request:str, params:dict)
  emitted to deliver the reply of a remote server file system request
remoteProjectReply(request:str, params:dict)
  emitted to deliver the reply of a remote server project related request
remoteReply(category:int, request:str, params:dict)
  emitted to deliver the reply of an unknown category
remoteServerReply(request:str, params:dict)
  emitted to deliver the reply of a remote server control request
showMenu(name:str, menu:QMenu)
  emitted when a menu is about to be shown. The name of the menu and a reference to the menu are given.

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

EricServerInterface | Constructor
__connectToServer | Private slot to connect to a remote eric-ide server.
__connectionStateChanged | Private slot to handle the connection state change.
__createCoverageInterface | Private method to create and register the 'Coverage' eric-ide server interface.
__createDebuggerInterface | Private method to create and register the 'Debugger' eric-ide server interface.
__createEditorConfigInterface | Private method to create and register the 'EditorConfig' eric-ide server interface.
__createFilesystemInterface | Private method to create and register the 'Filesystem' eric-ide server interface.
__handleDisconnect | Private slot handling a disconnect of the client.
__handleServerError | Private method handling server error replies.
__handleServerVersionReply | Private method to handle the reply of a 'Version' request.
__manageServerProfiles | Private slot to show a dialog to manage the eric-ide server connection profiles.
__receiveJson | Private slot handling received data from the eric remote server.
__serverProfileTriggered | Private slot to handle the selection of a remote server connection.
__showEricServerMenu | Private slot to display the server menu.
__showServerProfilesMenu | Private slot to prepare the eric server profiles menu.
__shutdownServer | Private slot to shut down the currently connected eric-ide server.
connectToServer | Public method to connect to the given host and port.
disconnectFromServer | Public method to disconnect from the eric remote server.
getHost | Public method to get the connected host as "host name:port".
getHostName | Public method to get the name of the connected host.
getServiceInterface | Public method to get a references to a specific service interface by service name.
initActions | Public slot to initialize the eric-ide server actions.
initMenus | Public slot to initialize the eric-ide server menus.
initToolbar | Public slot to initialize the eric-ide server toolbar.
isServerConnected | Public method to check, if a connection to an eric-ide server has been established.
parseHost | Public method to parse a host string generated with 'getHost()'.
sendJson | Public method to send a single command to a client.
serverVersions | Public slot to request the eric-ide version of the server.
shutdownServer | Public method shutdown the currebtly connected eric-ide remote server.

### Static Methods

None

#### EricServerInterface (Constructor)

EricServerInterface(parent=None)

Constructor

parent (QObject (optional))
  reference to the parent object (defaults to None)

#### EricServerInterface.__connectToServer

__connectToServer()

Private slot to connect to a remote eric-ide server.

#### EricServerInterface.__connectionStateChanged

__connectionStateChanged(connected)

Private slot to handle the connection state change.

connected (bool)
  flag indicating the connection state

#### EricServerInterface.__createCoverageInterface

__createCoverageInterface()

Private method to create and register the 'Coverage' eric-ide server interface.

#### EricServerInterface.__createDebuggerInterface

__createDebuggerInterface()

Private method to create and register the 'Debugger' eric-ide server interface.

#### EricServerInterface.__createEditorConfigInterface

__createEditorConfigInterface()

Private method to create and register the 'EditorConfig' eric-ide server interface.

#### EricServerInterface.__createFilesystemInterface

__createFilesystemInterface()

Private method to create and register the 'Filesystem' eric-ide server interface.

#### EricServerInterface.__handleDisconnect

__handleDisconnect()

Private slot handling a disconnect of the client.

#### EricServerInterface.__handleServerError

__handleServerError(reply, params)

Private method handling server error replies.

reply (str)
  name of the error reply
params (dict)
  dictionary containing the specific reply data

#### EricServerInterface.__handleServerVersionReply

__handleServerVersionReply(reply, params)

Private method to handle the reply of a 'Version' request.

reply (str)
  name of the eric-ide server reply
params (dict)
  dictionary containing the reply data

Raises ValueError:
  raised in case of an unsupported reply

#### EricServerInterface.__manageServerProfiles

__manageServerProfiles()

Private slot to show a dialog to manage the eric-ide server connection profiles.

#### EricServerInterface.__receiveJson

__receiveJson()

Private slot handling received data from the eric remote server.

#### EricServerInterface.__serverProfileTriggered

__serverProfileTriggered(act)

Private slot to handle the selection of a remote server connection.

act (QAction)
  reference to the triggered profile action

#### EricServerInterface.__showEricServerMenu

__showEricServerMenu()

Private slot to display the server menu.

#### EricServerInterface.__showServerProfilesMenu

__showServerProfilesMenu()

Private slot to prepare the eric server profiles menu.

#### EricServerInterface.__shutdownServer

__shutdownServer()

Private slot to shut down the currently connected eric-ide server.

#### EricServerInterface.connectToServer

connectToServer(host, port=None, timeout=None, clientId="")

Public method to connect to the given host and port.

host (str)
  host name or IP address of the eric remote server
port (int (optional))
  port number to connect to (defaults to None)
timeout (int (optional))
  timeout im seconds for the connection attempt (defaults to None)
clientId (str (optional))
  string prepended to each message for validity checking (defaults to "")

Return:
  flag indicating success

Return Type:
  bool

#### EricServerInterface.disconnectFromServer

disconnectFromServer()

Public method to disconnect from the eric remote server.

#### EricServerInterface.getHost

getHost()

Public method to get the connected host as "host name:port".

Return:
  connected host as "host name:port" or an empty string, if there is no valid connection

Return Type:
  str

#### EricServerInterface.getHostName

getHostName()

Public method to get the name of the connected host.

Return:
  name of the connected host or an empty string, if there is no valid connection

Return Type:
  str

#### EricServerInterface.getServiceInterface

getServiceInterface(name)

Public method to get a references to a specific service interface by service name.

name (str)
  service name

Return:
  reference to the service interface

Return Type:
  QObject

Raises ValueError:
  raised to indicate an unsupported server interface was requested

#### EricServerInterface.initActions

initActions()

Public slot to initialize the eric-ide server actions.

#### EricServerInterface.initMenus

initMenus()

Public slot to initialize the eric-ide server menus.

Return:
  reference to the main eric-ide server menu

Return Type:
  QMenu

#### EricServerInterface.initToolbar

initToolbar(toolbarManager)

Public slot to initialize the eric-ide server toolbar.

toolbarManager (EricToolBarManager)
  reference to a toolbar manager object

Return:
  the toolbar generated

Return Type:
  QToolBar

#### EricServerInterface.isServerConnected

isServerConnected()

Public method to check, if a connection to an eric-ide server has been established.

Return:
  flag indicating the interface connection state

Return Type:
  bool

#### EricServerInterface.parseHost

parseHost(host)

Public method to parse a host string generated with 'getHost()'.

host (str)
  host string

Return:
  tuple containing the host name and the port

Return Type:
  tuple of (str, int)

#### EricServerInterface.sendJson

sendJson(category, request, params, callback=None, flush=False)

Public method to send a single command to a client.

category (EricRequestCategory)
  service category
request (str)
  request name to be sent
params (dict)
  dictionary of named parameters for the request
callback (function (optional))
  callback function for the reply from the eric remote server (defaults to None)
flush (bool (optional))
  flag indicating to flush the data to the socket (defaults to False)

#### EricServerInterface.serverVersions

serverVersions()

Public slot to request the eric-ide version of the server.

#### EricServerInterface.shutdownServer

shutdownServer()

Public method shutdown the currebtly connected eric-ide remote server.

Up